//FoodClerk.h
#ifndef FoodClerk_H
#define FoodClerk_H

#include "list.h"
#include "synch.h"
#include <stdarg.h>
#include <string>
#include "line.h"

class FoodClerk
{
	public:
		FoodClerk(char* name, Line* line);
		~FoodClerk();
		void SendMessage(char* name, int argc, ...);
		void SendMessage(char* name, IterList* args);
		void Scheduler();
		void Start();
		
		MsgList* msgList;
		void* replyTo;
		Lock* msgLock;
		Thread* myThread;
		char* myName;
		Condition* sleepCon;
		
		Line* myLine;
		float* moneyCollected;
		bool onBreak;
		//Possible statuses for FoodClerk: {Idle, WaitingForCust,  WaitingForPay, TalkingToManager, OnBreak}
		std::string status;
		float POPCORN_PRICE;
		float SODA_PRICE;
		int popcornRequested;
		int sodaRequested;
		float money;
		
		bool CallNextInLine();
		void AcceptPopcornRequest(void* custPtr, int amount);
		void AcceptSodaRequest(void* custPtr, int amount);
		void GiveFood(void* custPtr, float payment);
		void GiveManagerMoney(void* mngrPtr);
		void TellStatus(void* mngrPtr);
		void ContinueOn();
		void GoOnBreak();
		void ComeOffBreak();
};


#endif
